<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>
<%@ include file="/WEB-INF/jsp/includes/header.jsp" %>
<%@ taglib prefix="postings" tagdir="/WEB-INF/tags/postings" %>
<div>
	<sec:authorize ifAnyGranted="ROLE_SELLER,ROLE_BUYER"> 
		<h2>Welcome: <sec:authentication property="principal.firstName"/> <sec:authentication property="principal.lastName"/>!</h2>
	</sec:authorize>
	
	<p>Your last login was at:
	<c:choose>
		<c:when test="${currentUser.lastLoginAt eq null}">
			<strong>not set yet (you're first time login user)</strong>
		</c:when>
		<c:otherwise>
			<strong><fmt:formatDate type="both" dateStyle="medium" timeStyle="medium" value="${currentUser.lastLoginAt}" /></strong>
		</c:otherwise>
	</c:choose>
	</p>
	<sec:authorize ifAnyGranted="ROLE_SELLER"> 
		<p><a href="<c:url value="/postings/add/"/>">Add new posting</a></p>
	</sec:authorize>
	<sec:authorize ifAllGranted="ROLE_BUYER">
		<postings:myBiddenPostings postings="${myBiddenPostings}" />
		<br />
	</sec:authorize>
	<sec:authorize ifAllGranted="ROLE_SELLER"> 
		<postings:sellers postings="${postings}" />
	</sec:authorize>
</div>

<%@ include file="/WEB-INF/jsp/includes/footer.jsp" %>